package com.xjtu.se.homework.client.history.controller;

import com.xjtu.se.homework.client.history.bean.FinalResult;
import com.xjtu.se.homework.common.Result;
import com.xjtu.se.homework.client.history.bean.HistoryResult;
import com.xjtu.se.homework.client.history.dto.HistoryDto;
import com.xjtu.se.homework.client.history.service.HistoryDisplayService;
import org.springframework.core.io.UrlResource;
import org.springframework.http.ResponseEntity;
import org.springframework.web.bind.annotation.*;

import javax.annotation.Resource;
import java.io.File;
import java.io.IOException;
import java.io.InputStream;
import java.util.List;

@RestController
@RequestMapping("/helper/history")
public class HistroyDisplayAPI {
    @Resource
    private HistoryDisplayService historyDisplayService;

    @GetMapping("/allHistory")
    public Result getAllHistory(HistoryDto dto) {
        List<FinalResult> historyResultList = historyDisplayService.findAllHistory(dto);
        return Result.success("历史记录", historyResultList);
    }

    @PostMapping("/modify")
    public Result modify(HistoryDto dto) {
        System.out.println(dto.getU_id());
        historyDisplayService.modify(dto);
        return Result.success("删除成功");
    }
}
